package com.wing.sell.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 销售代理商经销跟进记录
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("sel_agent_follow_record")
public class AgentFollowRecord extends BaseEntity<AgentFollowRecord> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum CustomerType implements IEnum<Integer> {

        /**
        * 潜在客户
        */
        one(0,"潜在客户"),
        /**
        * 意向客户
        */
        two(1,"意向客户"),
        /**
        * 正式客户
        */
        three(2,"正式客户");

        private int code;
        private String desc;

        CustomerType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum Status implements IEnum<Integer> {

        /**
        * 待审核
        */
        oncheck(0,"待审核"),
        /**
        * 已审核
        */
        check(1,"已审核");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 客户类型
     */
    private CustomerType customerType;

    /**
    * 客户类型描述
    */
    @TableField(exist = false)
    private String customerTypeDesc;

    public String getCustomerTypeDesc() {
        return customerType == null ? null : customerType.getDesc();
    }

    /**
     * 客户跟进类型ID
     */
    private Long followTypeId;

    /**
     * 客户跟进类型名称
     */
    @TableField(exist = false)
    private String followTypeName;

    /**
     * 跟进客户ID
     */
    private Long selAgtId;

    /**
     * 跟进对象联系人ID
     */
    private Long contactsId;

    /**
     * 跟进对象联系人名称
     */
    @TableField(exist = false)
    private String contactsName;

    /**
     * 跟进方式ID
     */
    private Long followModelId;

    /**
     * 跟进方式名称
     */
    @TableField(exist = false)
    private String followModelName;

    /**
     * 跟进结果描述
     */
    private String resultDesc;

    /**
     * 费用
     */
    private BigDecimal price;

    /**
     * 跟进结果类型ID
     */
    private Long followResultType;

    /**
     * 跟进结果类型名称
     */
    @TableField(exist = false)
    private String followResultTypeName;

    /**
     * 编号
     */
    private String code;

    /**
     * no
     */
    private Integer no;

    /**
     * day
     */
    private Integer day;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
    * 跟进时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private LocalDate establishTime;

    /**
     * 审核人ID
     */
    private Long checkById;

    /**
     * 审核人名称
     */
    private String checkBy;

    /**
    * 审核时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime checkTime;

}
